/*******************************************************************************
* CSCI321 Major Project 2010 - University of Wollongong                        *
********************************************************************************
* Program:		WeaveEdit                                              *
* Authors:		Simon Allen (Student#: 3457527, Unix: sa655)           *
*			Scott Bellis (Student#: 3479110, Unix: sjb900)         *
*			Jason Benger (Student#: 3454137, Unix: jb960)          *
*			Timothy Newmarch (Student#: 3459263 Unix: tgn336)      *
*			Benjamin Richardson (Student# 3467752, Unix: bjr401)   *
* Supervisor:		Daniel F. Saffioti                                     *
* Modified:		28/10/2010                                             *
* Description:		WeaveEdit is a highly portable collaborative text      *
*			editor and word processor, allowing several users to   *
*			read and edit multiple documents at the same time.     *
*			It is available for Mac OS X, Windows and Linux,       *
*			utilising Nokia's Qt development framework.            *
*******************************************************************************/


#ifndef BONJOURRESOLVER_H
#define BONJOURRESOLVER_H

#include <QObject>
#include <dns_sd.h>

class BonjourResolver : public QObject
{
	Q_OBJECT

public:
	BonjourResolver(QObject *parent = 0);
	~BonjourResolver();

	void resolveService(quint32 index, QString name, QString type, QString domain);

public slots:
	void receiveSomeInfo(int);	//called when the daemon has some info to send us (via callback)

signals:
	void bonjourError();
	void resolvedInfo(QString host, quint16 port);

private:
	DNSServiceRef serviceRef;

	static void DNSSD_API resolveCallback(DNSServiceRef ref, DNSServiceFlags flags,
										  quint32 index, DNSServiceErrorType error, const char* fullDomain, const char* host,
										  quint16 port, quint16 txtLen, const unsigned char *txtData, void *context);

};

#endif // BONJOURRESOLVER_H
